Below are programs that are mostly done, but are either missing pieces of code, or there is a typo, or any other kind of error. Your task is to fix the program so it would compile.
1. Difficulty: Easy
//**CODE THAT IS MISSING WILL BE REPLACED BY "??"**//There may be other errors that are not marked (ex: missing a semicolon)importgreenfoot.*;//Turtle that runs in circlespublicclass CircleTurtle extends Turtle
{private?? speed;private?? turnRate;private?? isClockwise;public CircleTurtle(){
speed =5;
turnRate =2;
isClockwise =true;
penDown();}publicint getSpeed(//Find how fast the turtle is moving{?? speed;}void isClockwise()//Makes the turtle switch directions{
isClockwise =??isClockwise
publicvoid act(){
move(5);if(isClockwise)
turn(2);??
turn(??2);}}
2. difficulty: easy
// *******************************************************************// RightTriangle.java//// Compute the length of the hypotenuse of a right triangle// given the lengths of the sides// *******************************************************************import java.util.???????;publicclass RightTriangle
{publicstaticvoid main (String[] args){double side1, side2 // lengths of the sides of a right triangledouble hypotenuse // length of the hypotenuse??????? scan =??? Scanner(System.in);// Get the lengths of the sides as inputSystem.out.print("Please enter the lengths of the two sides of "+"a right triangle (separate by a blank space): ");
side1 = scan.???????()//a
side2 =????.nextInt()//b// Compute the length of the hypotenuse
hypotenuse =Math.sqrt(Math.pow(?????, 2)+Math.pow(side2, 2))//c// Print the resultSystem.out.println("Length of the hypotenuse: "+ hypotenuse)}}
1. Difficulty: Easy
2. difficulty: easy